import {
    Toast,
    Dialog
  } from "vant";
  import cTitle from "components/title";
  import {
    scrollMixin
  } from "../../../utils/mixin";
  export default {
    mixins: [scrollMixin], //加载更多
    data() {
      return {
        list: [
          {
            mobile: '13111111111',
            password: '123123',
            uid: '94820',
            username: '13*******11',
            avatar: 'https://shops.cg500.com/static/images/photo-mr.jpg'
          },
          {
            mobile: '13111111199',
            password: '123123',
            uid: '95654',
            username: '13*******99',
            avatar: 'https://shops.cg500.com/static/images/photo-mr.jpg'
          },
          {
            mobile: '15584451495',
            password: '123123',
            uid: '96284',
            username: '15*******95',
            avatar: 'https://shops.cg500.com/static/images/photo-mr.jpg'
          }
        ],
        mobile: '',//手机号
        password: '',//密码
      };
    },
  
    components: {
      cTitle
    },
    activated() {
      console.log('active')
      if (!localStorage.getItem("uid")) {
        this.$router.push(this.fun.getUrl("login"));
        return
      }
      this.uid = localStorage.getItem("uid")
      // this.list = localStorage.getItem("niuniuLoginList") ? JSON.parse(localStorage.getItem("niuniuLoginList")) : []
    },
    computed: {
  
    },
    methods: {
      toBack(){
        this.$router.go(-1)
      },
      accountAdd() {
        if (this.fun.isTextEmpty(this.mobile)) {
          Toast("请填写手机号");
          return;
        }
        if (this.fun.isTextEmpty(this.password)) {
          Toast("请填写密码");
          return;
        }
        var url = "NiuTwo.add_zhanghao";
        let loading = "正在获取";
        var datainfo = {
          uid: localStorage.getItem("uid"),
          zhanghao: this.mobile,
          mima: this.password
        } 
        $http.post(url, datainfo, loading, "").then(async (response) => {
          // console.log(response);
          if (response.result === 1) {
            this.$router.push(this.fun.getUrl('nnAccountList'));
          }else {
            Toast(response.msg)
          }
        });
      },
      async login(data) { //登录
        console.log('登陆1111111');
        let that = this;
        let url;
        let datainfo;
        let type = "";
        let loading = "正在获取";
        url = "member.login.index";
        datainfo = {
          captcha: "",
          country: "86",
          is_sms: 0,
          login_checked: false, //协议是否选中
          mid: localStorage.getItem("mid"),
          mobile: data.mobile,
          mobileErr: "",
          password: data.password,
          passwordErr: "",
          uuid: 0,
        }
        console.log(datainfo, 'datainfodatainfodatainfo')
        $http.post(url, datainfo, loading, "", type).then(async (response) => {
          // console.log(response);
          if (response.result === 1) {
            that.$router.push(this.fun.getUrl("home"));
          }
        });
      },
      changeTabs(index) {
        this.currentTabs = index;
        this.page = 1;
        this.list = [];
        this.getList();
      },
      openPicker() {
        this.pickerShow = true;
      },
  
  
    }
  };